package com.example.hms.controller;


import com.example.hms.service.UserService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import utll.Result;
import utll.ResultSubmit;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Map;


@RestController
@RequestMapping("/user")
public class UserController {
    @Resource
    private UserService userService;

    @RequestMapping(value = "lgoin",method = RequestMethod.POST)
    public Result login(@RequestBody Map<String,String> map, HttpServletRequest request) {
        String userId = map.get("userId");
        String userPassword = map.get("userPassword");
        if (userId == null || userId.isEmpty() || userPassword == null || userPassword.equals("")) {
            return ResultSubmit.error("登录失败，参数不全");
        }
        return userService.login(userId,userPassword,request);

    }
}
